<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			window.onload = function()
			{
				let input = document.querySelector('input');
				let btn = document.querySelector('button');
				btn.onclick = function()
				{
					let a = input.setAttribute('value', 10); 
					alert(input.getAttribute('value'));
				}	
			}
		</script>
	</head>
	<body>
		<input type="text" />
		<button>按钮</button>
	</body>
</html>